n = int(input())
ans = 0


def dfs(left, right, col, level):
    global ans
    if level == n:
        ans += 1
        return
    # 在某位置摆放皇后
    for i in range(n):
        if (col | left | right) & (1 << i): continue
        new_col = col | (1 << i)
        new_left = (left | (1 << i)) << 1
        new_right = (right | (1 << i)) >> 1
        dfs(new_left, new_right, new_col, level + 1)


dfs(0, 0, 0, 0)
print(ans)
